package org.Framework.Examples;

import java.awt.FlowLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JLabel;
import javax.swing.JWindow;
  
public class JWindowSnippet  
{  
public static void main(String[]args)  
{  
 //Create a JWindow  
 JWindow window=new JWindow();  
  
 //Create a JLabel that we want to add to JWindow  
 JLabel label=new JLabel("Click me to exit");  
  
 //Set layout for JWindow  
 window.setLayout(new FlowLayout());  
  
 //Add label to JWindow  
 window.add(label);  
  
 //Create Mouse Listener that listen when someone click on that JWindow  
 MouseListener ml=new MouseAdapter()  
 {  
  public void mousePressed(MouseEvent evt)  
  {  
   //Exit application  
   System.exit(0);  
  }  
 };  
  
 //Add Mouse Listener to JWindow  
 window.addMouseListener(ml);  
  
 //Set JWindow size with width=400 pixels and height=400 pixels  
 window.setSize(400,400);  
  
 //Make JWindow visible  
 window.setVisible(true);  
}  
}  

